'use strict';

module.exports = app => {
  const { model } = app;
  const { UUID, STRING, INTEGER } = app.Sequelize;

  const Reply = model.define(
    'Reply',
    {
      id: {
        type: INTEGER,
        primaryKey: true,
        autoIncrement: true,
      },
      topic_id: {
        type: INTEGER,
        comment: '评论/回复id',
      },
      topic_type: {
        type: INTEGER,
        allowNull: false,
        comment: '回复的类型 0 评论  1 回复',
      },
      content: {
        type: STRING(255),
        allowNull: true,
        comment: '回复内容',
      },
      from_userid: {
        type: UUID,
        allowNull: false,
        comment: '回复用户id',
      },
      to_userid: {
        type: UUID,
        allowNull: false,
        comment: '目标用户id',
      },
    },
    {
      tableName: 'cms_reply',
    }
  );

  Reply.associate = function() {

  };

  return Reply;
};
